<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <!-- 
            Replace path to template, title, header and body
            with actual data.
    -->
    <ui:composition template="/templates/template.xhtml">
        <ui:define name="pageTitle">Alterar Veículo</ui:define>
        <ui:define name="titleBody">Alterar Veículo</ui:define>
        <ui:define name="body">
            <h:panelGroup styleClass="painel">
                <h:form id="formulario">
                    <table style="margin: auto; text-align: left;" id="estiloTexto">
                        <tr>
                            <td>
                                <h:outputText value="Nome:" />
                            </td>
                            <td>
                                <h:inputText id="idNome" value="#{veiculoCtrl.veiculo.nome}" required="true" style="margin-left: 25px;" maxlength="25" ></h:inputText>
                                <h:message for="idNome"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:outputText value="Modelo:" />
                            </td>
                            <td>
                                <h:inputText id="idModelo" value="#{veiculoCtrl.veiculo.modelo}" style="margin-left: 25px;" maxlength="25" required="true"></h:inputText>
                                <h:message for="idModelo"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:outputText value="Cor:" />
                            </td>
                            <td>
                                <h:inputText id="idCor" value="#{veiculoCtrl.veiculo.cor}" style="margin-left: 25px;" maxlength="15" required="true"></h:inputText>
                                <h:message for="idCor"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:outputText value="Montadora:" />
                            </td>
                            <td>
                                <h:selectOneMenu id="idMontadora" value="#{veiculoCtrl.idMontadoraEscolhida}" style="margin-left: 25px;" required="true">
                                    <f:selectItem itemValue="" itemLabel="Selecione..."/>
                                    <f:selectItems value="#{veiculoCtrl.carregarMontadoras()}"/>
                                </h:selectOneMenu>
                                <h:message for="idMontadora"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:outputText value="Ano de Fabricação:" />
                            </td>
                            <td>
                                <h:inputText id="idAno" value="#{veiculoCtrl.veiculo.anoFabricacao}" maxlength="4" style="margin-left: 25px;" required="true" converterMessage="Este campo so permite a digitação de numeros">
                                    <f:convertNumber locale="pt_BR"/>
                                </h:inputText> 
                                <h:message for="idAno"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <h:commandButton value="Alterar"  actionListener="#{veiculoCtrl.alterar()}"> </h:commandButton>
                            </td>
                        </tr>
                    </table>
                    <a href="listarVeiculo.xhtml" style="margin-left: 25px; margin-top: -35px;"> Listar Veiculos</a> 
                    <br /><br /><br /><br /><br /><br /><br />
                    <br /><br /><br /><br /><br /><br /><br />
                    <br /><br /><br /><br /><br /><br /><br />
                    
                </h:form>
            </h:panelGroup>
        </ui:define>
    </ui:composition>

</html>